<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

namespace Home\Controller;
use OT\DataDictionary;

header('content-type:text/html;charset=utf8');

/**
 * 前台首页控制器
 * 主要获取首页聚合数据
 */
class IndexController extends HomeController {

	//系统首页
    public function index(){
        $nickname       =   I('nickname');
        $map['status']  =   array('egt',0);
        if(is_numeric($nickname)){
            $map['id|title']=   array(intval($nickname),array('like','%'.$nickname.'%'),'_multi'=>true);
        }else{
            $map['title']    =   array('like', '%'.(string)$nickname.'%');
        }

        $list   = $this->lists('shop',$map,'id');
        //$img   = $this->lists('price',$map,'id');
        //联表查询
        //$a=M('shop')->join("onethink_price on onethink_shop.id=onethink_price.sid")->select();
        $a = D('shop')->select();
        

        //dump($a);
        //dump(M('shop')->getLastSql());
        //dump($img);die;
        $this->assign('_list', $a);
        
        $this->meta_title = '商品';
        $this->display();
    }



}